// pages/myRecommend/myRecommend.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    date:{},
    list:[],
    page:1
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    that.teacher_commission()
    that.teacher_recommend()
  },
  get_chilender:function(e){
    wx.navigateTo({
      url: '/schoolclass/myRecommend_childer/index?id='+e.currentTarget.dataset.id,
    })
  },
  //分傭明細
  get_distribution:function(){
    wx.navigateTo({
      url: '/schoolclass/distribution/index',
    })
  },
  teacher_commission:function(){
    var that = this
    getApp().request({
            url: getApp().api.schoolclass.teacher_commission,
            method: "GET",
            data: {
            },   
            success: function (res) {
               console.log(res, '数据')
              that.setData({
                date:res.data
              })
            }
          });
  },
  teacher_recommend:function(){
    var that = this
    getApp().request({
            url: getApp().api.schoolclass.teacher_recommend,
            method: "GET",
            data: {
               page:that.data.page
            },   
            success: function (res) {
               console.log(res, '数据')
                that.setData({
                  list:res.data
                })
            }
          });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    var that = this
    that.setData({
      page:that.data.page + 1
    })
    getApp().request({
            url: getApp().api.schoolclass.teacher_recommend,
            method: "GET",
            data: {
               page:that.data.page
            },   
            success: function (res) {
               console.log(res, '数据')
              for(var i = 0;i<res.data.length;i++){
                that.data.list.push(res.data[i])
                that.setData({
                  list:that.data.list
                })
              }
            }
          });
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})